package com.wcs.exam.controller.admin.req;

import java.io.Serializable;
import java.io.Serial;
import java.util.List;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

/**
 * <p>
 * Admin-试题信息-编辑请求参数
 * </p>
 *
 * @author wcs
 * @since 2025-03-11
 */
@Getter
@Setter
@Accessors(chain = true)
@Schema(description = "Admin-试题信息-编辑请求参数")
public class AdminQuestionEditReq implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "主键不能为空")
    @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long id;

    @NotNull(message = "目录ID不能为空")
    @Schema(description = "目录ID", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long categoryId;

    @NotNull(message = "难度等级不能为空")
    @Schema(description = "难度等级(1:简单、2:一般、3:困难)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer difficultyLevel;

    @NotNull(message = "题目类型不能为空")
    @Schema(description = "题目类型(1:单选题、2:多选题、3:判断题、4:填空题、5:简答题)", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer questionType;

    @NotBlank(message = "题目内容不能为空")
    @Schema(description = "题目内容", requiredMode = Schema.RequiredMode.REQUIRED)
    private String questionTitle;

    @NotBlank(message = "题目答案不能为空")
    @Schema(description = "题目答案(多个答案用‘|’分隔)", requiredMode = Schema.RequiredMode.REQUIRED)
    private String questionAnswer;

    @Schema(description = "题目解析")
    private String questionAnalysis;

    @Valid
    @Schema(description = "选项信息")
    private List<Option> options;

    @Data
    @Schema(name = "AdminQuestionEditReq.Option", description = "Admin-试题信息-编辑-选项-请求参数")
    public static class Option implements Serializable {

        @Serial
        private static final long serialVersionUID = -2333583072920635209L;

        @Schema(description = "主键ID，不为空且存在时进行更新操作")
        private Long id;

        @NotBlank(message = "选项内容不能为空")
        @Schema(description = "选项内容", requiredMode = Schema.RequiredMode.REQUIRED)
        private String optionContent;
    }
}
